﻿using System;
using System.Data;
using System.Collections.Generic;
using Chenxin.Lib.Business.Entity;
namespace Chenxin.Lib.Business.BLL
{
    /// <summary>
    /// 业务逻辑类t_Intention_AddMoneyInfo 的摘要说明。
    /// </summary>
    public class t_Intention_AddMoneyInfo
    {
        public t_Intention_AddMoneyInfo()
        { }
        #region  成员方法
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Chenxin.Lib.Business.Entity.t_Intention_AddMoneyInfo model)
        {
            Chenxin.Lib.Business.DAL.t_Intention_AddMoneyInfo.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Chenxin.Lib.Business.Entity.t_Intention_AddMoneyInfo model)
        {
            Chenxin.Lib.Business.DAL.t_Intention_AddMoneyInfo.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(Guid RecordId)
        {

            Chenxin.Lib.Business.DAL.t_Intention_AddMoneyInfo.Delete(RecordId);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Chenxin.Lib.Business.Entity.t_Intention_AddMoneyInfo GetModel(Guid RecordId)
        {

            return Chenxin.Lib.Business.DAL.t_Intention_AddMoneyInfo.GetModel(RecordId);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return Chenxin.Lib.Business.DAL.t_Intention_AddMoneyInfo.GetList(strWhere);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Chenxin.Lib.Business.Entity.t_Intention_AddMoneyInfo> GetModelList(string strWhere)
        {
            DataSet ds = Chenxin.Lib.Business.DAL.t_Intention_AddMoneyInfo.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Chenxin.Lib.Business.Entity.t_Intention_AddMoneyInfo> DataTableToList(DataTable dt)
        {
            List<Chenxin.Lib.Business.Entity.t_Intention_AddMoneyInfo> modelList = new List<Chenxin.Lib.Business.Entity.t_Intention_AddMoneyInfo>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Chenxin.Lib.Business.Entity.t_Intention_AddMoneyInfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Chenxin.Lib.Business.Entity.t_Intention_AddMoneyInfo();
                    if (dt.Rows[n]["RecordId"].ToString() != "")
                    {
                        model.RecordId = new Guid(dt.Rows[n]["RecordId"].ToString());
                    }
                    if (dt.Rows[n]["IntentionId"].ToString() != "")
                    {
                        model.IntentionId = new Guid(dt.Rows[n]["IntentionId"].ToString());
                    }
                    model.IntentionCode = dt.Rows[n]["IntentionCode"].ToString();
                    if (dt.Rows[n]["AddedMoney"].ToString() != "")
                    {
                        model.AddedMoney = decimal.Parse(dt.Rows[n]["AddedMoney"].ToString());
                    }
                    if (dt.Rows[n]["AddEmployeeId"].ToString() != "")
                    {
                        model.AddEmployeeId = new Guid(dt.Rows[n]["AddEmployeeId"].ToString());
                    }
                    model.AddEmployee = dt.Rows[n]["AddEmployee"].ToString();
                    if (dt.Rows[n]["AddTime"].ToString() != "")
                    {
                        model.AddTime = DateTime.Parse(dt.Rows[n]["AddTime"].ToString());
                    }
                    if (dt.Rows[n]["Status"].ToString() != "")
                    {
                        model.Status = int.Parse(dt.Rows[n]["Status"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return Chenxin.Lib.Business.DAL.t_Intention_AddMoneyInfo.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  成员方法
    }
}

